<template>
	<view class="page_box">
		<view class="head_box " style="background-color: #92b9b7;">
			<yy-custom bgColor="#92b9b7" :isBack="true">
				<block slot="backText"></block>
				<block slot="content">申请补货</block>
			</yy-custom>
		</view>

		<view class="content_box ">
			<view class="head padding-left padding-top flex justify-between  ">
				<view class="flex flex-direction text-black">
					<text class="f24">总库存(箱)</text>
					<text class="f60 text-bold">{{numInfo}}</text>
				</view> 
				<view class="head-r flex  align-center justify-center"
					@click="jump('/pages/invManagement/lvlActivationC')">
					<image src="../../static/bibi.png" mode="aspectFill" style="width: 29rpx; height: 29rpx;"></image>
					<text class="text-white f32 margin-left-xs">申请补货</text>
				</view>
			</view>
			<view class="info flex justify-between align-center padding-lr">
				<text>处理人:</text>
				<view class="flex align-center ">
					<image :src="superUser.headimgurl" mode="aspectFill" style="width: 60rpx; height: 60rpx;"
						class="bg-brown round"></image>
					<text class="f30 text-black margin-left-sm">{{superUser.nickname}}</text>
					<view class="info-inside flex align-center justify-around margin-left-sm">
						<text class="cuIcon-favorfill margin-right-xs" style="color: #fbb03b;"></text>
						<text class="f26 text-white">{{superUser.level}}</text>
					</view>
				</view>
			</view>
			<view class="recording padding margin-top flex justify-between bg-white">
				<text class="f30 text-black">补货记录:</text>
				<view class="flex f30">
					<text class="flex flex-direction align-center  a" @click="flg(0)"
						:class="sts == 0 ? 'style' : ''">待审</text>
					<text class="flex flex-direction align-center a" @click="flg(1)"
						:class="sts == 1 ? 'style' : ''">通过</text>
					<text class="flex flex-direction align-center a" @click="flg(2)"
						:class="sts == 2 ? 'style' : ''">驳回</text>
				</view>

			</view>
			<scroll-view scroll-y="true" class="scroll-y" @scrolltolower="lower">
				<block v-if="sts == 0">
					<view class="padding flex flex-direction bg-white margin-bottom"
						v-for="(item, index1) in getListFrom" :key="index1">
						<view class="flex justify-between margin-bottom">
							<text class="f24 text-gray">发起时间：{{item.createDt}}</text>
							<text class="f28 text-gray">待审核</text>
						</view>
						<view></view>
						<view class=" flex justify-between  align-center">
							<view class="">
								<view class="padding-tb-xs solid-bottom flex align-center"
									v-for="(item1, index) in item.order" :key="index">
									<view class="radius bg-gray padding-xs" style="width: 100rpx; height: 100rpx;">
										<image :src="item1.commodityImg" mode="aspectFill"
											class="radius bg-gradual-red wh100"></image>
									</view>
									<view class="flex flex-direction   margin-left-sm">
										<text class="text-black f30 ">液态全活菌（{{item1.commodityType}}）</text>
										<text class="text-black f30 ">数量: {{item1.num}}</text>
										<!-- <text class="text-gray f26 margin-top-xs ">净含量：5ml X 20袋</text> -->
									</view>
									<text></text>
								</view>
							</view>

						</view>
					</view>
				</block>
				<block v-if="sts == 1">
					<view class="padding flex flex-direction bg-white margin-bottom"
						v-for="(item, index1) in getListFrom" :key="index1">
						<view class="flex justify-between margin-bottom">
							<text class="f24 text-gray">发起时间：{{item.createDt}}</text>
							<text class="f28 text-yellow">已通过</text>
						</view>
						<view></view>
						<view class=" flex justify-between  align-center">
							<view class="">
								<view class="padding-tb-xs solid-bottom flex align-center"
									v-for="(item1, index) in item.order" :key="index">
									<view class="radius bg-gray padding-xs" style="width: 100rpx; height: 100rpx;">
										<image :src="item1.commodityImg" mode="aspectFill"
											class="radius bg-gradual-red wh100"></image>
									</view>
									<view class="flex flex-direction  margin-left-sm">
										<text class="text-black f30 ">液态全活菌（{{item1.commodityType}}）</text>
										<text class="text-black f30 ">数量: {{item1.num}}</text>
										<!-- <text class="text-gray f26 margin-top-xs ">净含量：5ml X 20袋</text> -->
									</view>
									<text></text>
								</view>
							</view>

						</view>
					</view>
				</block>
				<block v-if="sts == 2">
					<view class="padding flex flex-direction bg-white margin-bottom"
						v-for="(item, index1) in getListFrom" :key="index1">
						<view class="flex justify-between margin-bottom">
							<text class="f24 text-gray">发起时间：{{item.createDt}}</text>
							<text class="f28 text-gray">已驳回</text>
						</view>
						<view></view>
						<view class=" flex justify-between  align-center">
							<view class="">
								<view class="padding-tb-xs solid-bottom flex align-center"
									v-for="(item1, index) in item.order" :key="index">
									<view class="radius bg-gray padding-xs" style="width: 100rpx; height: 100rpx;">
										<image :src="item1.commodityImg" mode="aspectFill"
											class="radius bg-gradual-red wh100"></image>
									</view>
									<view class="flex flex-direction  margin-left-sm">
										<text class="text-black f30 ">液态全活菌（{{item1.commodityType}}）</text>
										<text class="text-black f30 ">数量: {{item1.num}}</text>
										<!-- <text class="text-gray f26 margin-top-xs">净含量：5ml X 20袋</text> -->
									</view>
									<text></text>
								</view>
							</view>

						</view>
					</view>
				</block>
			</scroll-view>

		</view>
		<view class="foot_box"></view>
		<!-- 登录提示 -->
		<yy-login v-if="false"></yy-login>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				sts: 0,
				numInfo: 0,
				superUser: {},
				getListFrom: [],
			};
		},
		onShow() {},
		onLoad(e) {},
		onShow() {
			this.getList()
			this.getInfo()
			this.userInfo()
		},
		methods: {
			jump(url) {
				uni.navigateTo({
					url
				});
			},
			flg(e) {
				this.sts = e;
				this.getList()
			},

			lower() {

			},

			async getList() {
				let res = await this.$u.get('/order/orderList', {
					type: 0,
					status: this.sts,
					userId: uni.getStorageSync('data').id,
				}, {})
				if (res.code == 0) {
					this.getListFrom = res.data
				}
			},

			async getInfo() {
				let res = await this.$u.get('/repertory/' + uni.getStorageSync('data').id, {}, {})
				if (res.code == 0) {
					this.numInfo = res.data.totle
				}
			},

			async userInfo() {
				let res = await this.$u.get('/inviterrecord/page?superId=' + uni.getStorageSync('data').id, {}, {})
				if (res.code == 0) {
					this.superUser = res.data.superUser
				}
			},



		}
	};
</script>

<style lang="scss" scoped>
	.page_box {
		background-color: #f7f7f7;
		margin-top: -5rpx;

		.scroll-y {
			height: calc(100vh - 255px);
		}

		.content_box {
			.head {
				width: 100vw;
				height: 200rpx;
				background: #92b9b7;

				.head-r {
					width: 260rpx;
					height: 70rpx;
					background: #fbbd08;
					border-radius: 29rpx 0rpx 0rpx 29rpx;
				}
			}

			.info {
				width: 706rpx;
				height: 120rpx;
				background: #FFFFFF;
				border-radius: 20rpx;
				margin: 0 auto;
				margin-top: -50rpx;

				.info-inside {
					padding: 10rpx;
					height: 30rpx;
					background: linear-gradient(139deg, #393B56, #4F4F62);
					border-radius: 10rpx;
				}
			}

			.recording {
				.a {
					width: 140rpx;
				}

				.style {
					font-weight: 600;
				}

				.style::after {
					content: '';
					width: 50rpx;
					height: 6rpx;
					background: #FBB03B;
					border-radius: 3rpx;
					margin-top: 15rpx;
				}
			}

			.mark {
				width: 112rpx;
				height: 30rpx;
				background: linear-gradient(139deg, #393b56, #4f4f62);
				border-radius: 10rpx;
			}
		}
	}
</style>
